package com.jinlejia.bbs.bean.base;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 话题信息
 * @author 王进 on 2019/3/11.
 */

public class TopicBean implements Parcelable{
    private BBSUserBean topicUser; //话题发起者
    private String topicCode;   //话题编码
    private String topicTitle;  //话题名称
    private int reviewCount;      //话题阅读次数
    private int replyCount;      //话题回复次数
    private boolean isCollection; //是否收藏 true:已收藏 false:未收藏
    private boolean isOwn;      //是否是本人
    public TopicBean(){

    }

    protected TopicBean(Parcel in) {
        topicCode = in.readString();
        topicTitle = in.readString();
        reviewCount = in.readInt();
        replyCount = in.readInt();
        isCollection = in.readByte() != 0;
        isOwn = in.readByte() != 0;
    }

    public static final Creator<TopicBean> CREATOR = new Creator<TopicBean>() {
        @Override
        public TopicBean createFromParcel(Parcel in) {
            return new TopicBean(in);
        }

        @Override
        public TopicBean[] newArray(int size) {
            return new TopicBean[size];
        }
    };

    public String getTopicCode() {
        return topicCode;
    }

    public void setTopicCode(String topicCode) {
        this.topicCode = topicCode;
    }

    public String getTopicTitle() {
        return topicTitle;
    }

    public void setTopicTitle(String topicTitle) {
        this.topicTitle = topicTitle;
    }

    public int getReviewCount() {
        return reviewCount;
    }

    public void setReviewCount(int reviewCount) {
        this.reviewCount = reviewCount;
    }

    public int getReplyCount() {
        return replyCount;
    }

    public void setReplyCount(int replyCount) {
        this.replyCount = replyCount;
    }

    public boolean isCollection() {
        return isCollection;
    }

    public void setCollection(boolean collection) {
        isCollection = collection;
    }

    public BBSUserBean getTopicUser() {
        return topicUser;
    }

    public void setTopicUser(BBSUserBean topicUser) {
        this.topicUser = topicUser;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public boolean isOwn() {
        return isOwn;
    }

    public void setOwn(boolean own) {
        isOwn = own;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(topicCode);
        dest.writeString(topicTitle);
        dest.writeInt(reviewCount);
        dest.writeInt(replyCount);
        dest.writeByte((byte) (isCollection ? 1 : 0));
        dest.writeByte((byte) (isOwn ? 1 : 0));
    }
}
